package situ.autoweter.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.stereotype.Controller;
import situ.autoweter.service.SySurchargeService;
import situ.autoweter.entity.SySurcharge;
import java.util.*;
/**
 * SySurcharge的路由接口服务
 * 
 * @author 胡文
 *
 */
@Controller
public class SySurchargeController {

	/** SySurchargeService服务 */
	@Autowired
	private SySurchargeService sySurchargeService;
	
	/**
	 * 查询所有SySurcharge数据的方法
	 * @param value
	 * @return
	 */
	@RequestMapping(value = "querySySurcharge", produces = {"application/json;charset=UTF-8"})
	public String find(SySurcharge value,Map map) {
		 List<SySurcharge> list= sySurchargeService.find(value);
         map.put("items",list);
         return "页面名称自己改";
	}
	
	/**
	 * 通过id查询SySurcharge数据的方法
	 * 
	 * @return
	 */
	@RequestMapping(value = "querySySurchargeById/{id}", produces = {"application/json;charset=UTF-8"})
	public String findOne(@PathVariable(name="id") Object id,Map map) {
        SySurcharge obj=  sySurchargeService.findOne(id);
        map.put("SySurcharge",obj);
        return "页面名称自己改";
	}
	
	/**
	 * 插入SySurcharge属性不为空的数据方法
	 * 
	 * @return
	 */
	@RequestMapping(value = "saveSySurcharge", produces = {"application/json;charset=UTF-8"})
	public String save(SySurcharge value) {
		  sySurchargeService.saveNotNull(value);
        return "redirect:/querySySurcharge";
	}
	
	/**
	 * 更新SySurcharge属性不为空的数据方法
	 * 
	 * @return
	 */
	@RequestMapping(value = "updateSySurcharge", produces = {"application/json;charset=UTF-8"})
	public String update(SySurcharge value) {
		  sySurchargeService.updateNotNullById(value);
          return "redirect:/querySySurcharge";
	}
	
	/**
	 * 通过id删除SySurcharge数据方法
	 * 
	 * @return
	 */
	@RequestMapping(value = "delSySurchargeById/{id}", produces = {"application/json;charset=UTF-8"})
	public String delete(@PathVariable(name="id") Object id) {
		  sySurchargeService.deleteById(id);
          return "redirect:/querySySurcharge";
	}
}
